<html>
<head>
<title>Assembler quickstart</title>

<link rel="stylesheet" class="text/css" href="../styles/doc.css" />
<link rel="stylesheet" class="text/css" href="assembler-style.css" />
<script type="text/javascript" src="library.js"></script>

</head>
<body>
<h1>Assembler quickstart</h1>

<p>This is the Assembler quickstart page. For more detailed
information, see the <a href="assembler-howto.html">Assembler howto</a>
document.
</p>

<h2>what is an Assembler specification?</h2>
<p>
An Assembler <i>specification</i> is an RDF description of how to
construct a model and its associated resources, such as reasoners,
prefix mappings, and initial content. The Assembler vocabulary is
given in the 
<a href="../../vocabularies/assembler.n3">Assembler schema</a>, 
and we'll use the prefix <code>ja</code> for its identifiers.
</p>

<h2>what is an Assembler?</h2>

<p>
An <i>Assembler</i> is an object that implements the <code>Assembler</code>
interface and can construct objects (typically models) from Assembler
specifications. The constant <code>Assembler.general</code> is an
Assembler that knows how to construct the usual suspects.
</p>

<h2>how can I make a model according to a specification?</h2>

<p>Suppose the Model <code>M</code> contains an Assembler
specification whose <i>root</i> 
-- the Resource describing the whole Model to construct
is <code>R</code> (so <code>R.getModel() == M)</code>. Invoke:
</p>

<blockquote>
<code>Assembler.general.openModel(R)</code>
</blockquote>

<p>
The result is the desired Model. Further details about the 
<code>Assembler</code> interface, the special Assembler
<code>general</code>, and the details of specific Assemblers,
are deferred to the <a href="assembler-howto.html">Assembler howto</a>.
</p>

<h2>how can I specify ...</h2>

<p>In the remaining sections, the object we want to describe is
given the root resource <code>my:root</code>, and our examples
are written in N3.
</p>

<h3>... a memory model?</h3>

<pre>
my:root a ja:MemoryModel.
</pre>

<h3>... an inference model?</h3>

<pre>
my:root 
    ja:reasoner [ja:reasonerURL <i>theReasonerURL</i>]
    ; ja:baseModel <i>theBaseModelResource</i>
    .
</pre>

<i>theReasonerURL</i> is one of the reasoner (factory) URLs given in
the inference documentation and code; <i>theBaseModelResource</i> is
another resource in the same document describing the base model.

<h3>... a database model?</h3>

<pre>
my:root
    ja:connection <i>aConnectionresource</i>
    ; ja:modelName "<i>myModelName</i>"
    .
    
<i>aConnectionResource</i>
    ja:dbURL <i>theDatabaseURL</i>
    ; ja:dbUser "<i>the user name</i>"
    ; ja:dbPassword "<i>the user's password</i>"
    ; ja:dbType "<i>the database type, eg MySQL</i>"
    ; ja:dbClass "some.jena.driver.class"
    .
</pre>

<i>aConnectionResource</i> describes the connection to the desired database.
If a particular Java driver class has to be loaded, it is specified by
the <code>dbClass</code> property value. See the 
<a href="assembler-howto.html">Assembler howto</a> for ways in which
sensitive details such as passwords can be left out of the description.

<h3>... some initialising content?</h3>

<pre>
my:root
    ja:content [ja:externalContent &lt;someContentURL&gt;]
    <i>... rest of model specification ...</i>
    .
</pre>

The model will be preloaded with the contents of <i>someContentURL</i>.

<h3>... an ontology model?</h3>

<pre>
my:root
    ja:ontModelSpec ja:<i>OntModelSpecName</i>
    ; ja:baseModel <i>somebaseModel</i>
    .
</pre>

The <i>OntModelSpecName</i> can be any of the predefined Jena OntModelSpec
names, eg <code>OWL_DL_MEM_RULE_INF</code>. The baseModel is another model 
description - it can be left out,
in which case you get an empty memory model. See 
<a href="assembler-howto.html">Assembler howto</a> for construction
of non-predefined OntModelSpecs.

</html>
</body>
